function BoxMeter () {
	this.collectAddr = '000000000';
	this.MeterName = ' ';
	this.MeterNo = 1;
	this.MeterAddr = ' ';
	this.BoxAddr = ' ';
}
BoxMeter.prototype.getMeterName = function(val){
	this.MeterName = val;
}

BoxMeter.prototype.getMeterNo = function(val){
	this.MeterNo = val;
	this.MeterName = '表' + val;
}

BoxMeter.prototype.getMeterAddr = function(val){
	this.MeterAddr = val;
}

BoxMeter.prototype.getBoxAddr = function(val){
	this.BoxAddr = val;
}

BoxMeter.prototype.save = function(){
	let that = this;
	that.collectAddr = CommonUtil.getStorage('selCollectAddr');
	let sqlStr = "select * from BoxMeter where MeterAddr = '"+this.MeterAddr+"'";
	console.log(sqlStr);
	DB.selectSQL(sqlStr,function(data){
		if(data.length <= 0){
			let intoSql = 'INSERT INTO BoxMeter VALUES ("'+that.collectAddr;
			intoSql = intoSql +'", "'+that.MeterName;
			intoSql = intoSql +'", '+that.MeterNo;
			intoSql = intoSql +',"'+that.MeterAddr;
			intoSql = intoSql +'", "'+that.BoxAddr;
			intoSql = intoSql +'")';
			console.log(intoSql);
			DB.insertToSQL(intoSql,function(data){
				if(data == 'success'){
					CommonUtil.createElementHTML("UL",that.MeterAddr + '::数据成功保存',"getResult");
				}else if(data == 'fail'){
					CommonUtil.createElementHTML("UL",that.MeterAddr + '::数据保存失败',"getResult");
				}
			});
		}else{
			CommonUtil.createElementHTML("UL",that.MeterAddr + '::已存在',"getResult");
		}
	});
}

